package com.sq.futuralwakeupwordsdk.utils;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;

import com.sq.futuralwakeupwordsdk.R;


public class DialogUtils {
    public interface Callback {
        default void ok(){};
        default void cancel(){};
    }

    public static Dialog showWaitDlg(Context context, @StringRes int titleResId, @StringRes int contentResId) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        LayoutInflater inflater = LayoutInflater.from(context);
        View v = inflater.inflate(R.layout.wait_dlg, null);
        TextView title = v.findViewById(R.id.dialog_title);
        title.setText(titleResId);
        TextView content = v.findViewById(R.id.dialog_content);
        content.setText(contentResId);
        builder.setCancelable(false);
        Dialog dlg = builder.create();
        dlg.show();
        dlg.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        dlg.getWindow().setContentView(v);
        return dlg;
    }
}
